<?php if (!defined('THINK_PATH')) exit();?><!--style type="text/css">
.page .pageContent .bumen{width: 90%;position: relative;}
.page .pageContent .bumen span.error{position:absolute;right: 0px}
</style-->
<script type="text/javascript">
$(function(){
	$('.unit').on('change','.select',function(){
		var object=$(this);
		var id=$(this).val();if(id==0){object.nextAll().remove();return;}
		$.ajax({
			url:"<?php echo U('Member/getRole');?>",
			type:'post',
			data:{id:id},
			dataType:'json',
			success:function(data){
				object.nextAll().remove();
				if(data.length>0){
					object.removeClass('required');
					var html="<select class='select' name='auth[]'>";
					html+="<option value='0'>请选择</option>";
					for ( var i = 0; i < data.length; i++) {
						html+="<option value='"+data[i].id+"'>"+data[i].title+"</option>";
					}
					html+="</select>";
					//alert(html);
					object.parent().append(html);
				}
			}
		});
	});
})
function tijiao()
{
    var path="/Admin/Diliveryman";
    var uid=$('#worker').val();
    var username=$('#username').val();
    var bank_account=$('#bank_account').val();
    var bank_name=$('#bank_name').val();
    var bank_address=$('#bank_address').val();
	$.ajax({
		type:"POST",
		url :path+"/setBank",
		data:"username="+username+"&&bank_account="+bank_account+"&&bank_name="+bank_name+"&&bank_address="+bank_address+"&&worker="+uid,
		success:function(date){if(date==1){alert('添加成功!');$('.close').click();}else{alert('编辑成功!');}},
	});
}
</script>
<div class="page">
    <div class="pageContent">
        <form method="post" action="/Admin/Diliveryman/setBank" class="pageForm required-validate">
        	<input type="hidden" name="id" value="<?php echo ($dataInfo['id']); ?>" />
            <div class="pageFormContent" layoutH="68">
				<input type="hidden" value="" id="types" name="sex">
				<div class="unit">
	            <label>配送员ID：</label>
				<input type="text" style="border: 0;background: 0;font-size: 15px" id="worker2" value="<?php echo ($uid); ?>" />
				<input type="hidden" id="worker" name="worker" value="<?php echo ($uid); ?>" />
	            </div>
            	<div class="unit">
	                <label>开户人姓名：</label>
					<input type="text" name="username" id="username" value="<?php echo ($bank["username"]); ?>" username="username(element)"  class="required" />
					<input type="hidden" name="role" value="8">
	            </div>
	            <div class="unit">
	                <label>银行卡账号：</label>
	                <input type="text" name="bank_account" id="bank_account" value="<?php echo ($bank["bank_account"]); ?>" class="required"  />
	            </div>
	            <div class="unit">
	                <label>开户银行名：</label>
	                <input type="text" name="bank_name" id="bank_name" value="<?php echo ($bank["bank_name"]); ?>"  class="required" />
	            </div>
				<div class="unit">
	                <label>开户行网点：</label>
	                <input type="text" name="bank_address" id="bank_address" value="<?php echo ($bank["bank_address"]); ?>"  class="required"  />
	            </div>
            </div>
            <div class="formBar">
                <ul>
                     <li>
                        <div class="buttonSave">
                            <div class="buttonSaveContent">
                                <button type="button" onclick="tijiao()">
                            		<i class="iconfont">&#xe644;</i>保存
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonCancel">
                            <div class="buttonCancelContent">
                                <button type="button" class="close">
                                	<i class="iconfont">&#xe640;</i>取消
                                </button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </form>
    </div>
</div>